package com.tanhua.dubbo.server.api;

import com.alibaba.dubbo.config.annotation.Service;
import com.tanhua.dubbo.server.pojo.Log;
import com.tanhua.dubbo.server.vo.UserLocationVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;

@Service(version = "1.0.0")
public class LogApiImpl implements LogApi {

    @Autowired
    MongoTemplate mongoTemplate;
    @Autowired
    UserLocationApi1 userLocationApi1;
    @Override
    public void save(Long uid,String type) {
         Log log=new Log();
        log.setEquipment("移动端");
        log.setUserId(uid);
        log.setType(type);
        log.setLogTime(System.currentTimeMillis());
        UserLocationVo userLocationVo = userLocationApi1.queryByUserId(uid);
        log.setPlace(userLocationVo.getAddress());
        this.mongoTemplate.save(log);
    }
}
